/*!
 * tykhome - weixin.js
 * Author tykhome <yongketian@gmail.com>
 */

/**
 * Module dependencies.
 */

var securePort = process.env.PORT || 443;

var express = require('express');
var router = express.Router();

var forceSecure = require('../middlewares/httpsRedirect').forceSecure(securePort);
var weixin = require('../controllers/weixin');

// ===============================
// =======WeiXin Controller=======
// ===============================
router.get('/', weixin.signature);
router.post('/', weixin.msg);
// 发送消息 
router.get('/sendMsg', forceSecure, weixin.showCreateMsg);
router.post('/sendMsg', weixin.sendMsg);

// 上传多媒体文件 
router.get('/uploadMedia', weixin.showUploadMediaFrom);

// 创建用户分组
router.get('/userGroup', weixin.userGroupList);
router.get('/userGroup/create', weixin.showcreateUserGroupFrom);
router.post('/userGroup/create', weixin.createUserGroup);
router.get('/userGroup/:openid', weixin.userGroupInfo);

// 创建菜单
router.get('/menu/create', weixin.menuCreate);
router.get('/oauth2', weixin.oauth2);

module.exports = router;